#ifndef COMMONMQ_H_
#define COMMONMQ_H_
#include "general.h"

#define BORRA_BUFFER    while(getchar()!= '\n');

struct mymsg
{
    long mtype;
    char mtext[FILE_LEN];
};

int fatal (char * msg);

int getLine (char * line, int linelen, FILE * stream);

unsigned int getFileSize(const char * file_name);


void sndMQAns(int mqid, int mqtype, int code);
int rcvMQAns(int mqid, int mqtype);

/* Envia Informacion */
int send_data_MQ (int mqid, int mqtype, char * s_msg, int size);

/* Recibe Informacion */
int rcv_data_MQ (int mqid, int mqtype, char * r_msg);
int nrcv_data_MQ (int mqid, int mqtype, char * r_msg, int n);



int readsizeMQ (int mqid, int mqtype);
int readcomMQ (int mqid, int mqtype);

int snd_file_MQ (int mqid, int cliID, int servID, char * fname, int isdir);
int walkDirMQ(char *path, char *relPath, int mqid, int cliID, int servID);

int readNumMQ (char * msg, int * ret);
int getNumMQ (char * msg, int * ret);

int readParamMQ (char * msg, char * param);

#endif /*COMMONMQ_H_*/
